<template>
  <div class="">
    <div class="page-filter mb10 fl">
      <el-form ref="filter" :model="filter" label-width="0">
        <el-form-item class="mr10 mb5 fl">
          <ProFilter v-model="filter.pro_id" :get-data="getList" />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl" style="width: 300px">
          <el-button size="small" @click="app.resetFields($refs['filter'].$parent,'filter')">清 空</el-button>
          <el-button type="primary" size="small" @click="getList">查 询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table v-loading="app.loading" class="search-table" :data="list" border fit highlight-current-row style="width: 100%;">
      <el-table-column label="序号" align="center" width="56px">
        <template slot-scope="{$index}">
          {{ $index + 1 }}
        </template>
      </el-table-column>
      <el-table-column label="品名" width="260px" prop="name" />
      <el-table-column label="供应商" width="260px" prop="sup_name" />
      <el-table-column label="项目名称" width="260px" prop="pro_name" />
      <el-table-column label="类型" align="center" width="100px">
        <template slot-scope="{row}">
          <span v-if="row.type === 1">物料采购</span>
          <span v-if="row.type === 2">设备采购</span>
          <span v-if="row.type === 4">库存出库</span>
        </template>
      </el-table-column>
      <el-table-column label="单价" align="right" width="100px">
        <template slot-scope="{row}">
          {{ app.toFix(row.price, 2) }}
        </template>
      </el-table-column>
      <el-table-column label="采购数" align="right" width="80px" prop="total" />
      <el-table-column label="规格型号" width="220px" prop="sku" />
      <el-table-column label="材质" width="320px" prop="parameter" />
      <el-table-column label="品牌" width="140px" prop="brand" />
      <el-table-column label="单位" width="80px" prop="unit" />
      <el-table-column label="备注" min-width="260px" prop="remark" />
    </el-table>
    <pagination v-show="filter.pageAll>0" :total="filter.pageAll" :page.sync="filter.pageCurrent" :limit.sync="filter.pageNumber" @pagination="getList" />
    <Dialog ref="dialog" :get-data="getList" :info="dialog" />
  </div>
</template>

<script>
import ProFilter from '@/components/ProFilter'
import { warehousings } from '@/api/purchase/purchase'
import Dialog from './components/info-dialog'
import page from '@/utils/page'

export default {
  components: { Dialog, ProFilter },
  extends: page,
  props: {
    reqList: {
      default: warehousings,
      type: Function
    }
  },
  data() {
    return {
    }
  },
  created() {
  },
  methods: {
  }
}
</script>
